import { HTMLElement } from 'node-html-parser';
import s from './ns';
import P01 from './P01';
import { IFeidaoAiNodejsComponent } from '@feidao/web/interfaces';
import nodejs from '@feidao/web/atom/nodejs/msg/nodejs';
import render from '@feidao/web/atom/nodejs/render/render';
import init from '@feidao/web/framework/nodejs/d/component';
import { Params } from '../atom/params2query';
import p2q from '../atom/params2query';

const daoke = {
	async init(fd: IFeidaoAiNodejsComponent, ...args: any[]) {
		console.log('init n', args);
		const q = p2q(fd.data.params as Params);
		const query = {
			criteria: {},
			sort: q.sort,
			page_no: 1,
			page_size: 0
		};
		const res = await nodejs("hr_manage", "teach_staff_find", query);
		if (res.count != 0) {
			render(fd.data.node, res.dataArray, P01, 'P01');
		}
	}
};
export default function main(html: HTMLElement, url: string, query: any) {
	return init('teach-staff-export-001', s, daoke, html, url, query, { spaceid: 'hr_manage', systemid: '6051', refsystemid: '@refsystemid' });
}
